import { TreeChildModel } from '@/components/CityAreaSelecter/city.module';
import { $http } from './index';

export interface DurationAndFrequencyRes {
    duration: number[];
    frequency: number[];
}

// 获取城市数据 0：省市树，1：等级树，2：拼音树
export function getCityTreeData(treeType: number): Promise<Array<TreeChildModel>> {
    return $http.get(`/dictArea/tree/${treeType}`);
}

// 获取时长频次
export function getDurationAndFrequency(): Promise<DurationAndFrequencyRes> {
    return $http.get('/dict/durationAndFrequency');
}

// 创建方案获取projectId
export function getProjectId(params: { publishStrategy: number }): Promise<string> {
    return $http.post('/project/save', params);
}
// 更新指标
export function updatefocusGoal(params: {projectId: string,focusGoal:number[]}): Promise<string> {
    return $http.post('/project/update/focusGoal', params);
}

// 分众策略分享
export function getShareStrategy(params: { projectId: string; resourceOwner: number }): Promise<string> {
    return $http.post('/project/shareStrategy', params);
}
// 点位明细分享
export function shareResourceDetails(params: { projectId: string; strategyId?: string,resourceOwner:number,mediaType:number }): Promise<string> {
    return $http.post('/project/shareResourceDetails', params);
}
